//
//  LoginRectView.m
//  YIJU2.0HD
//
//  Created by 张金国 on 16/5/18.
//  Copyright © 2016年 Mr.X. All rights reserved.
//

#import "LoginRectView.h"
#import "Masonry.h"

@interface LoginRectView ()

@property (nonatomic ,strong)UITextField    *textField ;

@property (nonatomic ,strong)UIView         *bottomLineView;

@end

@implementation LoginRectView

#pragma mark - init
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        [self setupConstraints];
    }
    return self;
}

#pragma mark - private
- (void)setupConstraints {
    [self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];

    [self.bottomLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self);
        make.height.equalTo(@2);
    }];
}

#pragma mark - getter

- (UITextField *)textField {
    if (!_textField) {
        _textField = [[UITextField alloc]init];
        _textField.leftViewMode = UITextFieldViewModeAlways;
        _textField.tintColor = [UIColor whiteColor];
        _textField.textAlignment = NSTextAlignmentCenter;
        _textField.clearButtonMode = UITextFieldViewModeWhileEditing;
        _textField.keyboardType = UIKeyboardTypeNumberPad;
        [self addSubview:_textField];
    }
    return _textField;
}

- (UIView *)bottomLineView {
    if (!_bottomLineView) {
        _bottomLineView = [[UIView alloc]init];
        _bottomLineView.backgroundColor = [UIColor whiteColor];
        [self addSubview:_bottomLineView];
    }
    return _bottomLineView;
}

- (void)setImageUrl:(NSString *)imageUrl {
    self.textField.leftView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:imageUrl]];
}




@end
